import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { IndexComponent } from './pages/index/index.component';
import { LoginComponent } from './pages/login/login.component';
import { RoleListComponent } from './components/role-list/role-list.component';
import { MetaListComponent } from './components/meta-list/meta-list.component';
import { UserListComponent } from './components/user-list/user-list.component';
import { MenuListComponent } from './components/menu-list/menu-list.component';
import { HomeComponent } from './components/home/home.component';
import { StaticListComponent } from './components/static-list/static-list.component';

const routes: Routes = [
  { path: '', redirectTo: 'index', pathMatch: 'full'},
  { path: 'login', component: LoginComponent },
  {
    path: 'index',
    component: IndexComponent,
    children: [
      { path: '', redirectTo: 'home', pathMatch: 'prefix' },
      {
        path: 'home',
        component: HomeComponent,
        data: {
          bread: ['购房中心']
        }
      },
      {
        path: 'role-list',
        component: RoleListComponent,
        data: {
          bread: ['主页', '用户管理', '角色列表']
        }
      },
      {
        path: 'user-list',
        component: UserListComponent,
        data: {
          bread: ['主页', '用户管理', '用户列表']
        }
      },
      {
        path: 'meta-list',
        component: MetaListComponent,
        data: {
          bread: ['主页', '用户管理', '权限列表']
        }
      },
      {
        path: 'menu-list',
        component: MenuListComponent,
        data: {
          bread: ['主页', '用户管理', '菜单列表']
        }
      },
      {
        path: 'file-list',
        component: StaticListComponent,
        data: {
          bread: ['主页', '用户管理', '文件列表']
        }
      }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes, {
    useHash: true
  })],
  declarations: [],
  exports: [RouterModule]
})
export class AppRoutingModule {}
